<?php

if (!defined('IN_ADMIN')) {
    exit('Access Denied');
}

$mpurl = 'admin.php?ac=manage_forbidlogin';
$list = array();
if($_GET ['op'] == "actionManage"){
    $uid    =    $_GET['uid'];
    $action =    $_GET['action'];
    $time   =    $_GET['time'];
    $param = array(
            'do' => $action,
            'format' => 'json',
            'uid' => $uid,
            'time' => $time,
    );
    $content = get_api_content($_SC ['apiurl'], $param);
    $content = json_decode($content);
    if ($content->resultData == 1) {
        $msg = "操作成功!";
        cpmessage($msg);
    }
    $msg = "操作失败，请重试一次!";
    if ($content->errorNo) {
        $msg .= "errorNo:" . $content->errorNo;
    }
    cpmessage($msg);
	exit;
}elseif ($_GET ['op'] == "getAllFobList"){
    $start              = intval($_GET ['start']) > 1 ? intval($_GET ['start']) : 0;
    $length             = intval($_GET ['perpages']) > 1 ? intval($_GET ['perpages']) : 20;
    $param  = array(
            'do' 		=> 'getAllFobList',
            'format'	=> 'json',
            'start'     => $start,
            'length'    => $length,
    );
    
     
    $content = get_api_content($_SC ['apiurl'], $param);
    $content = json_decode($content);
    $list = object_to_array($content->resultData);
    $list['list']    =    1;

    $mpurl  = 'admin.php?ac=manage_forbidLogin&op=getAllFobList';
    $pageurl = multi($start, $length, $mpurl);
    $nextpurl  = $pageurl ['next'];
    $prevpurl  = $pageurl ['prev'];
    $mpurl     = $pageurl ['urls'];
    $firstpurl = $pageurl ['first'];
    
    $perpages = array(
            $length => ' selected'
    );
    include_once template("admin/".'manage_forbidlogin');
    exit;
    // 解除封禁
}elseif ($_GET ['op'] == "delForbInfo"){
    $param  = array(
            'do' 		=> 'delForbInfo',
            'format'	=> 'json',
            'start'     => $start,
            'length'    => $length,
            'id'        => intval($_GET['id']),
    );
    
     
   $content = get_api_content($_SC ['apiurl'], $param);
    $content = json_decode($content);
    if ($content->resultData == 1) {
        $msg = "操作成功!";
        cpmessage($msg);
    }
    $msg = "操作失败，请重试一次!";
    if ($content->errorNo) {
        $msg .= "errorNo:" . $content->errorNo;
    }
    cpmessage($msg);
	exit;
}else {
    $start              = intval($_GET ['start']) > 1 ? intval($_GET ['start']) : 0;
    $length             = intval($_GET ['perpages']) > 1 ? intval($_GET ['perpages']) : 20;
    $param  = array(
            'do' 		=> 'getForbidLoginList',
            'format'	=> 'json',
            'start'     => $start,
            'length'    => $length,
    );
    
     
    $content = get_api_content($_SC ['apiurl'], $param);
    $content = json_decode($content);
    $list = object_to_array($content->resultData);
    $list['login']    =    1;
    
    $mpurl  = 'admin.php?ac=manage_forbidLogin&op=getForbidLoginList';
    $pageurl = multi($start, $length, $mpurl);
    $nextpurl  = $pageurl ['next'];
    $prevpurl  = $pageurl ['prev'];
    $mpurl     = $pageurl ['urls'];
    $firstpurl = $pageurl ['first'];
    
    $perpages = array(
            $length => ' selected'
    );
    include_once template("admin/manage_forbidlogin");
    exit;
}




